package com.debai.mapper;

import com.debai.pojo.Order;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrderMapper {

    @Insert("insert into order_table(position_id,screen_id,user_id,money,create_time,business_angel)" +
            " values(#{positionId},#{screenId},#{userId},#{money},now(),#{businessAngel})")
    int insert(Order order);

    @Delete("delete from order_table where id = #{id}")
    int delete(int id);
    @Update("update order_table set screen_id=#{screenId},money=#{money},business_angel=#{businessAngel} where id = #{id}")
    int updata(Order order);

//    @Select("SELECT position_id,sum(money) sum_money from order_table group by position_id  ")
    List<Order> selectAllPosititionSumMoney(LocalDateTime startTime, LocalDateTime endTime);


    List<Order> selectOnePasition(int positionId, LocalDateTime startTime, LocalDateTime endTime);


    List<Order> detailOfPasitionOrder(int positionId, LocalDateTime startTime, LocalDateTime endTime);


}
